<template>
	<view>
		<!-- <u-navbar :is-back='false' :border-bottom='false' title='企业入驻' title-color='#ffffff' :is-fixed='true' :background='background1'>
			<view class="slot-wrap">
				<view @click="back"
					style="border-radius: 50%;width: 50rpx;height: 50rpx;background-color:rgba(0,0,0,.2);position: relative;">
					<text class="iconfont icon-xiangzuo"
						style="font-size: 40rpx;color: #FFFFFF;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);"></text>
				</view>
			</view>
		</u-navbar> -->
		<view style="width: 750rpx;height: 366rpx;background: linear-gradient(180deg, #1fb0ac 0%, #F5F5F5 100%);position: relative;">
			<view class="" style="padding-top: 50rpx;padding-bottom: 30rpx;position: relative;">
				<scroll-view v-if="ss_xianshi" scroll-y="true" class="ul" style="max-height: 400rpx;">
					<view class="li" v-for="(item,index) in sousuo_list" :key="index" @click="select(item)">{{item.Name}}</view>
				</scroll-view>
				<view class="maincontent">
					<view class="input" style="padding: 10rpx 0;overflow: hidden;">
						<text style="float: left;">企业LOGO<text style="color: red;">*</text></text>
						<view style="flex: 1;">
							<image @click="chooseImage1" :src="logo?logo:xx" style="width:80rpx;height: 80rpx;float: right;border-radius: 50%;" mode=""></image>
						</view>
					</view>
					<view class="input" style="">
						<text>企业名称<text style="color: red;">*</text></text>
						<input style="text-align: right;" type="text"   @input="syqy" placeholder="请输入企业名称" v-model="name" />
					</view>
					<view :class="['input1',xin_list_arr.length>0?'a':'active']">
						<text>企业身份<text style="color: red;">*</text></text>
						<input v-if="xin_list_arr.length<=0" @click="shenfen" :disabled="true" style="text-align: right;" type="text"   placeholder="请选择身份" />
						<input v-if="xin_list_arr.length>0" @click="shenfen" :disabled="true" style="text-align: right;" type="text"   placeholder="已选择身份" />
					</view>
					<view v-if="xin_list_arr.length>0" style="overflow: hidden;margin-top: 20rpx;border-bottom: 1px solid #eee;" class="pp_box">
						<view class="qbpp_ac" v-for="(item,index) in xin_list_arr" :key='index' style="height: 46rpx;line-height: 46rpx;border-radius: 35rpx;font-size: 26rpx;float: left;width: 142rpx;box-sizing: border-box;padding: 0 4rpx;text-align: center;">
							{{item.title}}
						</view>
					</view>
					<view @click="fanwei" style="line-height: 100rpx;display: flex;" :class="fanwei_list.length>0?'a':'active'">
						<view style="flex: 2;color: #333333;font-size: 30rpx;">
							经营品类<text style="color: red;">*</text>
						</view>
						<view style="flex: 4;color: #333333;font-size: 30rpx;text-align: right;">
							<text v-if="fanwei_list.length<=0">请选择</text>
							<text v-if="fanwei_list.length>0">已选择</text>
							 <text class="iconfont icon-xiangyou" style="font-size: 30rpx;"></text>
						</view>
					</view>
					<view v-if="fanwei_list.length>0" style="overflow: hidden;">
						<text v-for="(item,index) in fanwei_list" :key='index'>
							<text style="float: left;line-height: 60rpx;height: 60rpx;padding: 0 30rpx;margin: 10rpx;font-size: 26rpx;color: #333333;background-color: #F3F3F3;border-radius: 30rpx;">
								{{item.one}}-
								<text v-if="item.two!=''">{{item.two}}</text>
								<text v-if="item.two==''">全部</text>
								<!-- <text v-if="item.three!=''">-{{item.three}}</text>
								<text v-if="item.three==''">-全部</text> -->
							</text>
						</text>
					</view>
					<view class="input" style="border: none;position: relative;">
						<text>通讯地址<text style="color: red;">*</text></text>
						<input style="text-align: right;padding-right: 80rpx;" type="text"   placeholder="输入地址或点击选择" v-model="address" />
						<image @click="address_xx" src="https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/miniapp/address_rz.png" style="width: 60rpx;height: 60rpx;position: absolute;top: 50%;right: 0;transform: translateY(-50%);" mode=""></image>
					</view>
				</view>
				<view style="width:92%;background-color: #FFFFFF;border-radius: 16rpx;margin: 30rpx auto 0;box-sizing: border-box;padding: 0 30rpx;">
					<view @click="men_shichang" style="line-height: 100rpx;display: flex;">
						<view style="flex: 2;color: #333333;font-size: 30rpx;">
							企业所在市场
						</view>
						<view style="flex: 3;color: #333333;font-size: 30rpx;text-align: right;">
							<text v-if="shichang_list.length<=0">请选择</text>
							<text v-if="shichang_list.length>0">已选择</text>
							 <text class="iconfont icon-xiangyou" style="font-size: 30rpx;"></text>
						</view>
					</view>
					<view v-if="shichang_list.length>0" style="overflow: hidden;margin-top: 20rpx;">
						<view class="qbpp_ac" v-for="(item,index) in shichang_list" :key='index' style="height: 70rpx;line-height: 70rpx;border-radius: 10rpx;font-size: 26rpx;float: left;box-sizing: border-box;padding: 0 20rpx;text-align: center;float: left;margin-bottom: 20rpx;margin-right: 20rpx;">
							{{item.name}}
						</view>
					</view>
				</view>

				<view style="line-height: 40rpx;color: #333333;font-size: 24rpx;width: 92%;margin: 30rpx auto 0;text-align: center;">
					以下信息用于核实和展示企业基本情况，请如实上传。
				</view>
				<view style="width: 92%;background-color: #FFFFFF;margin: 20rpx auto;border-radius: 16rpx;">
					<view style="width: 100%;">
						<view style="overflow: hidden;margin: 20rpx 0 20rpx;" class="boxx">
							<view style="float: left;width: 50%;text-align: center;">
								<image @click="chooseImage2" :src="business_license?business_license:xx" style="width:160rpx;height: 160rpx;" mode=""></image>
								<view class="xiao yihang">
									<text style="color: red;">*</text>营业执照
								</view>
							</view>
							<view style="float: left;width: 50%;text-align: center;">
								<image @click="chooseImage3" :src="id_card?id_card:xx" style="width: 160rpx;height: 160rpx;" mode=""></image>
								<view class="xiao yihang">
									<text style="color: red;">*</text>法人身份证
								</view>
							</view>
						</view>

					</view>
				</view>

				<view style="width: 92%;background-color: #FFFFFF;margin: 20rpx auto;border-radius: 16rpx;">
					<view style="width: 100%;">
						<view style="overflow: hidden;margin: 20rpx 0 20rpx;" class="boxx">
							<view style="float: left;width: 50%;text-align: center;">
								<image @click="chooseImage4" :src="sc?sc:xx" style="width: 160rpx;height: 160rpx;" mode=""></image>
								<view class="xiao yihang">
									食品经营许可证
								</view>
							</view>
						</view>
					</view>
				</view>
				<view style="width: 92%;margin: 20rpx auto;box-sizing: border-box;padding: 30rpx;background-color: #FFFFFF;border-radius: 16rpx;">
					<view style="line-height: 80upx;color: #333333;font-size: 30upx;height: 80rpx;">
						企业/产品轮播图<text style="color: red;">*</text>(750*600)
					</view>
					<view class="upload">
						<view class="uploadimgcont">
							<view class="uploadimga" v-for="(item,index) in addimgArray_arr" :key="index">
								<view class="delete" @click="imgdelete(index)">
									<view class="deleteline">
									</view>
								</view>
								<image :src="item" mode="aspectFill"></image>
							</view>
							<view v-if="addimgArray_arr.length<9"  class="uploadimg" @click="chooseImage6">
								<image :src="xx" style="border-radius: 10rpx;" mode=""></image>
							</view>
						</view>
					</view>
				</view>

				<!-- <view style="width: 92%;background-color: #FFFFFF;margin: 20rpx auto;border-radius: 16rpx;">
					<view style="width: 100%;">
						<view style="overflow: hidden;margin: 20rpx 0 20rpx;" class="boxx">
							<view style="float: left;width: 50%;text-align: center;">
								<image @click="chooseImage10" :src="background?background:xx" style="width:160rpx;height: 160rpx;" mode=""></image>
								<view class="xiao yihang">
									企业详情图(750*600)
								</view>
							</view>
						</view>

					</view>
				</view> -->

				<!-- <view class="maincontent">

					<view style="padding-bottom: 10rpx;">
						<view style="font-size: 26rpx;color: #000000;line-height: 80rpx;">
							企业介绍
						</view>
						<textarea   style="background-color: #eeeeee;width: 100%;border-radius: 10rpx;padding: 20rpx;box-sizing: border-box;" placeholder="请填写企业介绍" v-model="introduction"  />
					</view>
					<view style="padding-bottom: 10rpx;">
						<view style="font-size: 26rpx;color: #000000;line-height: 80rpx;">
							主营产品
						</view>
						<textarea   style="background-color: #eeeeee;width: 100%;border-radius: 10rpx;padding: 20rpx;box-sizing: border-box;" placeholder="请填写主营产品" v-model="manage_category"  />
					</view>
				</view> -->
				<!-- <view style="line-height: 40rpx;color: red;font-size: 26rpx;width: 92%;margin: 30rpx auto 0;">
					企业入驻为收费项目,提交申请后将有工作人员联系对接。
				</view> -->
				<view v-if="pingguo_xian" class="moren">
					<label @click="ismoren">
						<checkbox :checked="default1==1?true:false" style="transform:scale(0.7);color: #1fb0ac;" /><text>我已阅读并同意</text>
					</label>
					<text @click="rzxz" style="color: #1fb0ac;">⟪企业入驻须知⟫</text>
				</view>

				<button v-if="pingguo_xian" :disabled="fa" @click="kai" style="width: 92%;margin: 0rpx auto 60rpx;background-color: #1fb0ac;height: 90rpx;line-height: 90rpx;color: #FFFFFF;text-align: center;border-radius: 45rpx;font-size: 30rpx;">
					申请开通
				</button>

			</view>
		</view>

		<lb-picker ref="picker" v-model="xueli" mode="selector" :dataset="{ name: xueli }" :list="listarr" @confirm="handleConfirm">
		</lb-picker>
		<lb-picker ref="picker1" v-model="city" mode="selector" :dataset="{ name: city }" :list="city_list"
			@confirm="handleConfirm1">
		</lb-picker>

		<uni-popup id="popup" ref="popup" :type="type_a" :animation="true">
			<view class="" style="background-color: #FFFFFF;padding:20upx 30upx;border-radius: 20upx;width: 500rpx;">
				<view style="text-align: center;height: 100upx;line-height: 100upx;color: #333333;font-weight: 600;font-size: 32rpx;">
					入驻须知
				</view>
				<scroll-view scroll-y="true" style="height: 400rpx;margin-bottom: 20rpx;">
					<view style="line-height: 50rpx;color: #606266;font-size: 24rpx;" v-html="rule">

					</view>
				</scroll-view>
				<view @click="guan" style="width: 100%;height: 80rpx;line-height: 80rpx;background-color: #1fb0ac;border-radius: 40rpx;color: #FFFFFF;font-size: 30rpx;text-align: center;">
					确定
				</view>
			</view>
		</uni-popup>

		<uni-popup id="popup" ref="popup1" :type="type_a" :animation="true">
			<view class="" style="background-color: #FFFFFF;padding:20upx 30upx;border-radius: 20upx;width: 600rpx;">
				<view style="text-align: center;height: 100upx;line-height: 100upx;color: #333333;font-weight: 600;font-size: 32rpx;">
					选择支付方式
				</view>
					<view @click="zffs(index)" style="display: flex;line-height: 60rpx;text-align: center;" v-for="(item,index) in zf_list" :key='index'>
						<view  style="flex: 2;text-align: center;">
							<image  :src="index+1==zf_status?xz:wxz"  style="width: 30rpx;height: 30rpx;margin-top: 15rpx;" mode=""></image>
						</view>
						<view style="flex:3;text-align: left;">
							{{item.name}}   {{item.price}}元
						</view>
					</view>

				<view class="" style="display: flex;margin-top: 30rpx;">
					<view @click="quxiao1" style="margin-right:20rpx;flex:1;height: 80rpx;line-height: 80rpx;background-color: #C0C0C0;border-radius: 40rpx;color: #FFFFFF;font-size: 30rpx;text-align: center;">
						取消
					</view>
					<view @click="guanbi1" style="flex:1;height: 80rpx;line-height: 80rpx;background-color: #1fb0ac;border-radius: 40rpx;color: #FFFFFF;font-size: 30rpx;text-align: center;">
						确定
					</view>
				</view>
			</view>
		</uni-popup>

		<!--推荐全部品牌 -->
		<uni-popup id="popup" ref="popup2" :type="type_b" :animation="true">
			<view class="" style="background-color: #FFFFFF;padding:20upx;border-radius: 20upx 20rpx 0 0;width: 100%;box-sizing: border-box;">
				<view
					style="text-align: center;height: 100upx;line-height: 100upx;color: #222222;font-size: 32rpx;font-family: Semibold;">
					企业身份选择
				</view>
				<scroll-view :scroll-y="true" style="max-height: 500rpx;">
					<view>

						<view style="overflow: hidden;" class="pp_box">
							<view @click="tj_dj_ren(index)" :class="item.check?'qbpp_as':'qbpp_ac'" v-for="(item,index) in yuan_list_arr" :key='index' style="height: 70rpx;line-height: 70rpx;border-radius: 35rpx;font-size: 26rpx;float: left;width: 167rpx;box-sizing: border-box;padding: 0 4rpx;text-align: center;" class="yihang">
								{{item.title}}
							</view>
						</view>
					</view>

				</scroll-view>
				<view style="overflow: hidden;margin: 20rpx 0;display: flex;">
					<view @click="tj_pp_cz" style="flex:1;line-height: 88rpx;text-align: center;border-radius: 44rpx;color: #FFFFFF;background-color: #666666;font-size: 30rpx;float: left">
						重置
					</view>
					<view  @click="tj_pp_qd"  style="flex:1;line-height: 88rpx;text-align: center;border-radius: 44rpx;color: #FFFFFF;background-color: #1fb0ac;font-size: 30rpx;float: right;margin-left: 20rpx;">
						确定
					</view>
				</view>
				<text @click="tj_pp_guanbi" class="iconfont icon-guanbi" style="color: #000000;font-size: 28rpx;position: absolute;top:40rpx;right:20rpx;font-weight: 600;">

				</text>
			</view>
		</uni-popup>


		<lb-picker ref="picker" v-model="l_zhiwei" mode="selector" :dataset="{ name: l_zhiwei }" :list="list_arr"
			@confirm="handleConfirm">
		</lb-picker>
		<uploadImg :singleNum="true" ref="uploadImg1" v-model="logo" permissionCameraContent="获取拍照权限是为了上传企业logo" permissionAlbumContent="获取相册权限，是为了上传企业logo" />
		<uploadImg :singleNum="true" ref="uploadImg2" v-model="business_license" permissionCameraContent="获取拍照权限是为了上传营业执照" permissionAlbumContent="获取相册权限，是为了上传营业执照" />
		<uploadImg :singleNum="true" ref="uploadImg3" v-model="id_card" permissionCameraContent="获取拍照权限是为了是为了上传法人身份证" permissionAlbumContent="获取相册权限，是为了上传法人身份证" />
		<uploadImg :singleNum="true" ref="uploadImg4" v-model="sc" permissionCameraContent="获取拍照权限是为了上传食品生产许可证" permissionAlbumContent="获取相册权限，是为了上传食品生产许可证" />
		<uploadImg :singleNum="true" ref="uploadImg5" v-model="head" permissionCameraContent="获取拍照权限是为了上传门头照" permissionAlbumContent="获取相册权限，是为了上传门头照" />
		<uploadImg :singleNum="false" ref="uploadImg6" v-model="addimgArray_arr" permissionCameraContent="获取拍照权限是为了上传企业/产品轮播图" permissionAlbumContent="获取相册权限，是为了上传企业/产品轮播图" />
	</view>
</template>

<script>
	import LbPicker from '@/components/lb-picker'
	import inputSearch from '@/components/p-inputSearch/inputSearch1.vue'
	export default {
		components: {
			LbPicker,
			inputSearch
		},
		data(){
			return{
				yuan_list_arr:[],
				list_arr:[],
				background1:{ background: 'linear-gradient(180deg, #0078FF 0%, #1fb0ac 100%)' },
				default1:0,
				xz:'https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/miniapp/54.png',
				wxz:'https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/miniapp/53.png',
				xx:'https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20220531/69aba21c7e2329034b458df0181cdc9f.png',
				fu:'https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/20210917/d5a8f205dbac682ff00c82a1262e79fe.jpg',
				fu1:'https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/20210917/6e1feb399cc68f470b680a140faeb5dc.jpg',
				list:[],
				list1:[
					{
						id:8,
						name:'生产企业',
						check:false
					},
					{
						id:3,
						name:'自有工厂',
						check:false
					},
					{
						id:4,
						name:'自有研发',
						check:false
					},
					{
						id:5,
						name:'全国发货',
						check:false
					},
					{
						id:6,
						name:'售后保障',
						check:false
					}
				],
				list2:[
					{
						id:7,
						name:'经销商',
						check:false
					},
					{
						id:5,
						name:'全国发货',
						check:false
					},
					{
						id:6,
						name:'售后保障',
						check:false
					}
				],
				list3:[
					{
						id:1,
						name:'设备企业',
						check:false
					},
					{
						id:2,
						name:'原辅料企业',
						check:false
					},
					{
						id:3,
						name:'自有工厂',
						check:false
					},
					{
						id:4,
						name:'自有研发',
						check:false
					},
					{
						id:5,
						name:'全国发货',
						check:false
					},
					{
						id:6,
						name:'售后保障',
						check:false
					}
				],
				name:'',
				id:'',
				tpgz:1,
				type:'',
				xueli:'',
				listarr:[],
				qb_list:[],
				address:'',
				l_name:'',
				l_mobile:'',
				gao:'',
				logo:'',
				wechat_account:'',
				business_license:'',
				id_card:'',
				authorization:'',
				sc:'',
				head:'',
				qualification:'',
				background:'',
				addimgArray_arr:[],
				city_list:['全国','本地'],
				city:'',
				introduction:'',
				type_a:'center',
				type_b:'bottom',
				rule:'',
				longitude:'',
				latitude:'',
				zf_list:[
					{
						name:'线上支付'

					},{
						name:'线下支付'
					}],
				zf_status:1,
				fa:false,
				shop_id:'',
				sheng:'',
				province:'',
				city:'',
				district:'',
				manage_category:'',

				fanwei_list:[],
				qita:'',
				l_zhiwei:'',
				sf_id:'',
				special_type:1,
				xin_list_arr:[],

				dataSource: [],
				id:'',
				sousuo_list:'',
				ss_xianshi:false,
				shichang_list:[],
				pingguo_xian:false,
			}
		},
		onLoad(option) {
			// this.tpgz=option.type
			// if(this.tpgz==1){
			// 	this.list=this.list1
			// }else if(this.tpgz==2){
			// 	this.list=this.list2
			// }else if(this.tpgz==3){
			// 	this.list=this.list3
			// }
			// this.type=option.type
			// this.one()
			this.qiandao()
			this.pingguo()
			// this.user_xx()
			// this.yang()
			// this.jiage()
			if(option.id){
				this.special_type=option.id
			}

			this.user_info()
			this.sflb()
		},
		onShow() {
			this.user_fw()
		},
		onPullDownRefresh() {
			this.one()
			// this.qiandao()
			this.yang()
		       setTimeout(function () {
		           uni.stopPullDownRefresh();
		       }, 1500);
		  },
		methods:{
			// 上传图片
			chooseImage1() {
				this.$refs.uploadImg1.open()
			},
			chooseImage2() {
				this.$refs.uploadImg2.open()
			},
			chooseImage3() {
				this.$refs.uploadImg3.open()
			},
			chooseImage4() {
				this.$refs.uploadImg4.open()
			},
			chooseImage5() {
				this.$refs.uploadImg5.open()
			},
			chooseImage6() {
				this.$refs.uploadImg6.open()
			},
			men_shichang:function(){
				uni.navigateTo({
					url:'gt_shichang?list='+JSON.stringify(this.shichang_list)
				})
			},
			select:function(e){
				this.ss_xianshi=false
				this.name=e.Name
			},
			syqy:function(){
				this.post('api/index/qcc_company',{keywords:this.name},true).then(res=>{
					if(res.code==1){
						this.sousuo_list=res.data.data
						if(this.sousuo_list.length>0){
							this.ss_xianshi=true
						}
					}
				})
			},
			tj_dj_ren:function(index){
				this.yuan_list_arr[index].check=!this.yuan_list_arr[index].check
				this.$forceUpdate()
			},
			tj_pp_cz:function(){
				// this.xin_list_arr=[]
				for(let i=0;i<this.yuan_list_arr.length;i++){
					this.yuan_list_arr[i].check=false
				}
				this.$forceUpdate()
			},
			tj_pp_qd:function(){
				this.xin_list_arr=[]
				for(let i=0;i<this.yuan_list_arr.length;i++){
					if(this.yuan_list_arr[i].check){
						this.xin_list_arr.push(this.yuan_list_arr[i])
					}
				}
				this.$refs.popup2.close()
			},
			tj_pp_guanbi:function(){
				this.$refs.popup2.close()
			},
			user_info:function(){
				this.post('api/client/info','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						// this.l_zhiwei=res.data.client_position_text
						// this.sf_id=res.data.client_position
						if(res.data.company_check==1){
							uni.showModal({
							    title: '提示',
							    content: '您的企业入驻申请正在审核，请耐心等待！',
							    success: function (res) {
							        if (res.confirm) {
							            console.log('用户点击确定');
										uni.navigateBack({
											delta:1
										})
							        } else if (res.cancel) {
							            uni.navigateBack({
							            	delta:1
							            })
							        }
							    }
							});
						}
					}
				})
			},
			// 获取用户经营范围
			user_fw:function(){
				this.fanwei_list=[]
				this.post('api/firm/business_list','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						console.log(123445666464)
						this.fanwei_list=res.data
					}
				})
			},

			fanwei:function(){
				uni.navigateTo({
					url:'qiye_fanwei1'
				})
			},
			// 身份列表
			sflb: function() {
				let that=this
				this.post('api/firm_data/get_type', '', true).then(res => {
					console.log(res)
					if (res.code == 1) {
						this.yuan_list_arr = res.data
						// for (let i = 0; i < res.data.length; i++) {
						// 	that.list_arr.push(res.data[i].title)
						// }
						for (let i = 0; i < this.yuan_list_arr.length; i++) {
							this.yuan_list_arr[i].check=false
						}
					}
				})
			},
			handleConfirm(e) {
				let that = this
				let index = e.index[0] || e.index
				console.log(index, 123456)
				this.sf_id = this.yuan_list_arr[index].id
			},
			shenfen:function(){
				// this.$refs['picker'].show()
				this.$refs.popup2.open()
			},

			location(e){
				let that=this
				console.log(e)
				this.province=e.detail.value[0]
				this.city=e.detail.value[1]
				this.district=e.detail.value[2]
				that.sheng=this.province+'-'+this.city+'-'+this.district
			},
			jiage:function(){
				this.post('api/shop/price_count',{shop_type:1,shop_category:2},true).then(res=>{
					console.log(res)
					if(res.code==1){
						for(let i=0;i<this.zf_list.length;i++){
							this.zf_list[i].price=res.data
						}
					}
				})
			},

			zffs:function(index){
				this.zf_status=index+1
			},
			quxiao1:function(){
				this.fa=false
				this.$refs.popup1.close()
			},
			guanbi1:function(){
				let that=this
				this.fa=true
				this.$refs.popup1.close()
				let data={

					is_tops:0,
					shop_type:1,
					shop_id:this.shop_id,
					pay_type:this.zf_status,
					shop_category:2
				}
				this.post('api/shop/new_pay',data,true).then(res=>{
					console.log(res)
					if(res.code==1){
						if(this.zf_status==1){
							uni.getSystemInfo({
							    success: function (res) {
									let str = res.model
									console.log(str.indexOf("iPhone") != -1); // true
									that.post('api/index/wechat_check','',true).then(re=>{
										if(str.indexOf("iPhone") != -1){
											if(re.data==1){
												that.fukuan()
											}else{
												uni.showModal({
												    title: '温馨提示',
												    content: '由于相关规范，ios功能暂不可用！',
												    success: function (res) {
												        if (res.confirm) {

												        } else if (res.cancel) {

												        }
												    }
												});

											}
										}else{
											that.fukuan()
										}
									})

							    }
							});
						}else{
							uni.showToast({
								title: res.msg,
								icon: "none",
								duration: 1000
							})
							setTimeout(function(){
								uni.switchTab({
									url:'/pages/index/index'
								})
							},2000)
						}
					}
				})
			},
			pingguo:function(){
				let that=this
				uni.getSystemInfo({
					    success: function (res) {
							let str = res.model
							console.log(str.indexOf("iPhone") != -1); // true
							that.post('api/index/wechat_check','',true).then(re=>{
								if(re.data==1){
									that.pingguo_xian=true
								}else{
									that.pingguo_xian=false
								}
								// if(str.indexOf("iPhone") != -1){
								// 	if(re.data==1){
								// 		that.pingguo_xian=true
								// 	}else{
								// 		that.pingguo_xian=false
								// 	}
								// }else{
								// 	that.pingguo_xian=true
								// }
							})

					    }
					});
			},
			fukuan:function(){
				let that=this
				uni.requestPayment({
				    provider: 'wxpay',
				    timeStamp: res.data.pay.timeStamp,
				    nonceStr: res.data.pay.nonceStr,
				    package: res.data.pay.package,
				    signType: res.data.pay.signType,
				    paySign: res.data.pay.paySign,
				    success: function (res) {
				      uni.showToast({
				      	title: '支付成功',
				      	icon: "none",
				      	duration: 1000
				      })
					  setTimeout(function(){
						  uni.switchTab({
						  	url:'/pages/index/index'
						  })
					  },2000)
				    },
				    fail: function (err) {
						that.fa=false
				        console.log('fail:' + JSON.stringify(err));
						uni.showToast({
							title: '取消支付',
							icon: "none",
							duration: 1000
						})
				    }
				});
			},
			// 增加访问量
			yang:function(){
				this.post('api/homepage/pageviews',{path:'/pages/my/shop'},true).then(res=>{
					console.log(res)
				})
			},
			user_xx:function(){
				this.post('api/user/info','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						if(res.data.is_shop==0){
							uni.showModal({
							    title: '提示',
							    content: '您的企业入驻申请正在审核，请耐心等待！',
							    success: function (res) {
							        if (res.confirm) {
							            console.log('用户点击确定');
										uni.navigateBack({
											delta:1
										})
							        } else if (res.cancel) {
							            uni.navigateBack({
							            	delta:1
							            })
							        }
							    }
							});
						}else{

						}
					}
				})
			},
			// 浅到规则
			qiandao: function() {
				this.post('api/index/site', '', true).then(res => {
					console.log(res)
					if (res.code == 1) {
						this.rule = res.data.qyrzxy
					}
				})
			},
			rzxz:function(){
				uni.navigateTo({
					url:'/subpages/pages/rzxz?type='+3
				})
				return
				this.$refs.popup.open()
			},
			guan:function(){
				this.$refs.popup.close()
			},
			qiehuan:function(index){
				this.list[index].check=!this.list[index].check
			},
			tp_gz:function(index){
				this.tpgz=index
				if(this.tpgz==1){
					this.list=this.list1
				}else if(this.tpgz==2){
					this.list=this.list2
				}else if(this.tpgz==3){
					this.list=this.list3
				}
			},
			//设为默认
			ismoren(){
				if(this.default1==0){
					this.default1=1
				}else{
					this.default1=0
				}
			},
			back:function(){
				uni.navigateBack({
					delta:1
				})
			},

			handleTap(name) {
				this.$refs[name].show()
			},
			// handleConfirm(e) {
			// 	console.log(e)
			// 	let index=e.index[0] || e.index
			// 	this.id=this.qb_list[index].id
			// },
			handleConfirm1(e) {
				console.log(e)
				let index=e.index[0] || e.index
				this.city=e.value
			},
			// 获取一级分类
			one:function(){
				this.post('api/firm_data/category','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						this.qb_list=res.data
						for(let i=0;i<res.data.length;i++){
							this.listarr.push(res.data[i].name)
						}
					}
				})
			},
			// 获取位置
			address_xx:function(index){
				let that=this
				uni.authorize({
				        scope: 'scope.userLocation',
				        success(){ //1.1 允许授权
							 that.hqxxdd()
				        },
				     fail(){    //1.2 拒绝授权
				      uni.showModal({
				       content:'检测到您没打开获取信息功能权限，是否去设置打开？',
				        confirmText: "确认",
				        cancelText:'取消',
				        success: (res) => {
				         if(res.confirm){
				          uni.openSetting({
				           success: (res) => {
				            console.log(res);
				              that.hqxxdd()
				           }
				          })
				         }else{
				          console.log('取消');
				          return false;
				         }
				        }
				      })
				      return false;
				     }
				    })
			},
			// 获取详细地址
			hqxxdd:function(e){
				let that=this
				uni.chooseLocation({
				    success: function (res) {
						console.log(res)
				        console.log('位置名称：' + res.name);
				        console.log('详细地址：' + res.address);
				        console.log('纬度：' + res.latitude);
				        console.log('经度：' + res.longitude);
						that.address=res.address

						that.longitude=res.longitude
						that.latitude=res.latitude

						// that.city=res.address
				    }
				});
			},
			// 删除图片
			imgdelete(index) {
				// this.addimgArray.splice(index, 1)
				this.addimgArray_arr.splice(index, 1)
				// this.addimgArray.splice(index, 1)
			},


			kai:function(){
				let xin_id=[]
				for(let i=0;i<this.xin_list_arr.length;i++){
					if(this.xin_list_arr[i].check){
						 xin_id.push(this.xin_list_arr[i].id)
					}
				}
				let that=this
				if(this.default1==0){
					uni.showToast({
						title:'请同意企业入驻须知',
						icon: "none",
						duration: 1000
					})
					return
				}else if(this.address==''){
					uni.showToast({
						title:'请输入地址或点击选择',
						icon: "none",
						duration: 1000
					})
					return
				}
				if(this.addimgArray_arr.length<=0){
					uni.showToast({
						title:'请添加企业/产品轮播图',
						icon: "none",
						duration: 1000
					})
					return
				}
				// let arr=[]
				// for(let i=0;i<this.list.length;i++){
				// 	if(this.list[i].check){
				// 		arr.push(this.list[i].id)
				// 	}
				// }
				let sc_id=[]
				for(let i=0;i<this.shichang_list.length;i++){
					sc_id.push(this.shichang_list[i].id)
				}
				let data={
					special_type:this.special_type,
					name:this.name,
					client_position:xin_id.join(','),
					// industry_category_id:this.id,
					logo_image:this.logo,
					main_images:this.addimgArray_arr.join(','),
					business_license:this.business_license,
					legal_person_license:this.id_card,
					safety_license:this.sc,
					bazaar_id:sc_id.join(','),
					// facade_license:this.head,
					// other_license:this.qualification,
					main_content:this.introduction,
					longitude:this.longitude,
					latitude:this.latitude,
					province:this.province,
					city:this.city,
					district:this.district,
					address:this.address,
					// type:this.tpgz,
					// shop_type:1,
					// features:arr.join(','),
					// contact_name:this.l_name,
					// contact_mobile:this.l_mobile,
					manage_category:this.manage_category,
					notice:this.gao,
					// logo:this.logo,
					// wechat_account:this.wechat_account,
					// business_license:this.business_license,
					// id_card:this.id_card,
					// authorization:this.authorization,
					// sc:this.sc,
					// head:this.head,
					// qualification:this.qualification,
					// background:this.background,
					// banners:this.addimgArray_arr.join(','),
					// area:this.city,
					// introduction:this.introduction,
					// longitude:this.longitude || uni.getStorageSync('longitude'),
					// latitude:this.latitude || uni.getStorageSync('latitude')
				}
				this.post('api/firm/apply',data,true).then(res=>{
					console.log(res)
					if(res.code==1){
							uni.showToast({
							    title: res.msg,
							    duration: 1000,
								icon:'none'
							});
							that.fa=true
							// that.shop_id=res.data
							// that.$refs.popup1.open()
							setTimeout(function(){
								uni.switchTab({
									url:'/pages/index/wode'
								})
							},2000)
						}else{
							uni.showToast({
							    title: res.msg,
							    duration: 1000,
								icon:'none'
							});
						}
				})
			}


		}
	}
</script>

<style lang="scss">
	.ul {
		position: absolute;
		left: 4%;
		top: 270rpx;
		width: 92%;
		background: #eee;
		border-radius: 20rpx;
		z-index: 888;

		.li {
			border-bottom: 1upx solid #f5f5f5;
			line-height: 60upx;
			box-sizing: border-box;
			padding: 10rpx 30rpx;
			font-size: 28rpx;
			color: #666;
		}
	}
	.qbpp_ac{
		background-color: #F3F4F8;
		color: #222222;
	}
	.qbpp_as{
		background-color: #1fb0ac;
		color: #FFFFFF;
	}
	.pp_box>view{
		margin-bottom: 14rpx;
		margin-right: 14rpx;
	}
	.pp_box>view:nth-child(4n){
		margin-right: 0;
	}
	.moren{
		display: flex;
		align-items: center;
		height: 120upx;
		padding: 0 30upx;
		text{
			font-size: 26upx;
			color: #666666;
		}

	}
	.xiao{
		width: 100%;
		text-align: center;
		line-height: 60rpx;
		color: #999999;
		font-size: 24rpx;
	}
	// .boxx>view:nth-child(3n+2){
	// 	margin: 30rpx 105rpx;
	// }
	.boxx>view{
		margin: 60rpx 0 30rpx;
	}
	page {
		background-color: #f5f5f5 !important;
		// padding-bottom: 30rpx;
		font-family: Demibold;
	}

	.slot-wrap {
		display: flex;
		align-items: center;
		/* 如果您想让slot内容占满整个导航栏的宽度 */
		/* flex: 1; */
		/* 如果您想让slot内容与导航栏左右有空隙 */
		padding: 0 30rpx;
	}
	.maincontent{
		width: 92%;
		margin: 0 auto;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		background-color: #FFFFFF;
		border-radius: 16rpx;
		.input{
			height: 100upx;
			width: 100%;
			box-sizing: border-box;
			padding: 30rpx 0;
			// margin-left: 40upx;
			border-bottom: 2upx solid #f0f0f0;
			display: flex;
			align-items: center;
			text{
				width: 176upx;
				font-size: 30upx;
				color: #333333;

			}
			input{
				flex: 1;
				font-size: 30upx;
				color: #333333;
			}
		}
		.input1{
			height: 100upx;
			width: 100%;
			box-sizing: border-box;
			padding: 30rpx 0;
			// margin-left: 40upx;

			display: flex;
			align-items: center;
			text{
				width: 176upx;
				font-size: 30upx;
				color: #333333;

			}
			input{
				flex: 1;
				font-size: 30upx;
				color: #333333;
			}
		}
	}
	.active{
		border-bottom: 2upx solid #f0f0f0;
	}
	.a{
		border-bottom: none;
	}
	// 上传图片
	.upload {
		// background: #FFFFFF;
		// padding: 0 40rpx;
		// height: 100vh;
		// height: 700upx;

		.title {
			font-size: 30rpx;
			font-weight: bold;
			color: #343434;
			padding-top: 15rpx;
		}

		.uploadimgcont {
			display: flex;
			// justify-content: space-between;
			flex-wrap: wrap;
			// margin-top: 50rpx;
			// margin:30upx 0 136upx;

			.uploadimga {
				width: 186rpx;
				height: 186rpx;
				margin-right: 24upx;
				margin-bottom: 40upx;
				position: relative;

				.delete {
					width: 40rpx;
					height: 40rpx;
					border-radius: 50%;
					background: #5093ff;
					display: flex;
					align-items: center;
					justify-content: space-around;
					position: absolute;
					top: -10upx;
					left: -10upx;
					z-index: 4;

					.deleteline {
						background: #FFFFFF;
						height: 5rpx;
						width: 50%;
					}
				}

				image {
					width: 100%;
					height: 100%;
				}
			}

			.uploadimg {
				width: 200rpx;
				height:200rpx;
				background: #F9F9F9;
				border-radius: 10rpx;
				// overflow: hidden;
				position: relative;

				image {
					width: 100%;
					height: 100%;
				}

				view {
					position: absolute;
					bottom: 10rpx;
					left: 50%;
					width: 100%;
					text-align: center;
					transform: translateX(-50%);
					font-size: 28rpx;
					color: #404040;
				}
			}
		}

	}
	.input1{
		height: 90upx;
		width: 100%;
		box-sizing: border-box;
		// padding:0 46rpx;
		// margin-left: 40upx;
		display: flex;
		align-items: center;
		display: flex;
		// background-color: #F3F3F3;
		border-radius: 45rpx;
		.picker{
			flex: 1;
			height: 100upx;
			// padding-right: 20upx;
			.change{
				height: 100upx;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				image{
					width: 14upx;
					height: 24upx;
				}
				text{
					flex: 1;
					font-size: 30upx;
					padding-right: 20upx;
					color: #333333;
					white-space:nowrap;
					overflow:hidden;
					text-overflow:ellipsis;

				}
			}
		}
		text{
			width: 176upx;
			font-size: 30upx;
			color: #333333;

		}
		input{
			flex: 1;
			font-size: 30upx;
			color: #333333;
		}
	}
</style>
